@import url('../../style/themes/default.less');
.node-motion {
  transition: all .3s;
  overflow-y: hidden;
  &.node-motion-appear{ //为了防止 组件创建时已有高度，而动画height 要从 0-已有高度，导致组件会闪一下！
    height: 0;
  }
}


@ant-prefix:ym;
@treePrefixCls:~'@{ant-prefix}-tree';
@treeNodePrefixCls: ~'@{treePrefixCls}-treenode';

@checkboxPrefixCls:~'@{treePrefixCls}-checkbox'; //ym-tree-checkbox
@checkboxInnerPrefixCls: ~'@{checkboxPrefixCls}-inner';  //ym-tree-checkbox-inner

.@{treePrefixCls} {
  color: #000000d9;
  background-color: #fff;
  font-size: 14px;
  .@{treeNodePrefixCls} {
    width: 100%;
    margin: 0;
    padding: 0;
    // margin-bottom: 4px;
    white-space: nowrap;
    list-style: none;
    outline: 0;
    font-size: 0;
    min-height: 32px;
    display: flex;
    flex-flow: row nowrap;
    align-items: center;
    justify-content: flex-start;
    overflow-x: hidden;
    position: relative;
    &::after {
      position: absolute;
      content: '';
      // left: 1px;
      left: var(--left);
      right: 10px;
      bottom: 0;
      height: 0;
      background: transparent;
    }

    &-drag-active {
      &::after {
        height: 2px;
        background-color: @primary-color;
      }
    }
    &-disabled{

    }
  }


  &-indent {
    // flex: auto;
    &-unit {
      display: inline-block;
    }
  }

  &-draggable-icon {
    flex: 0 0 24px;
    height: 24px;
    display: flex;
    flex-flow: row nowrap;
    align-items: center;
    justify-content: center;
    cursor: move;
    font-size: 14px;
    &-disabled{
      cursor: not-allowed;
      color: #00000040;
    }
  }

  //Switcher
  &-switcher {
    flex: 0 0 24px;
    height: 24px;
    display: flex;
    flex-flow: row nowrap;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    // color: #cacaca;
    &-icon{
      font-size: 14px;
    }
    &-loading-icon {
      font-size: 14px;
      // color: @primary-color;
    }

    &-noop {
      cursor: default;

    }
    &_close {
      svg {
        transform: rotate(-90deg);
      }
    }

    &-leaf-line {
      position: relative;
      z-index: 1;
      width: 100%;
      height: 100%;
      // https://github.com/ant-design/ant-design/issues/31884
      &::before {
        position: absolute;
        top: 0;
        left: 11px;
        bottom: -4px;
        border-right: 1px solid #d9d9d9;
        content: ' ';
      }

      &::after {
        position: absolute;
        top: 0;
        right: 0;
        width: 12px;  //calc(24px- 14px);
        height: 13px; //calc(24px- 10px);
        border-bottom: 1px solid #d9d9d9;
        content: ' ';
      }
    }
  }



  //父级/children中的最后一个
  .@{treeNodePrefixCls}-leaf-last {
    .@{treePrefixCls}-switcher {
      &-leaf-line {
        &::before {
          position: absolute;
          top: 0;
          left: 11px;
          bottom: 12px;
          border-right: 1px solid #d9d9d9;
          content: ' ';
        }
      }
    }


  }


  &-checkbox {
    flex: 0 0 24px;
    height: 24px;
    display: flex;
    flex-flow: row nowrap;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    cursor: pointer;
    //1.一般状态
    &-inner{
      position: relative;
      width: 14px;
      height: 14px;
      border: 1px solid #d9d9d9;
      border-radius: 2px;
      transition: all .3s;
      border-collapse: separate;
      &::after{
        position: absolute;
        top: 50%;
        left: 21.5%;
        display: table;
        width: 5.71428571px;
        height: 9.14285714px;
        border: 2px solid transparent;
        border-top: 0;
        border-left: 0;
        transform: rotate(45deg) scale(0) translate(-50%, -50%);
        opacity: 0;
        transition: all .1s cubic-bezier(.71,-.46,.88,.6), opacity .1s;
        content: " ";
      }
    }
      //2.选中状态
    &-checked {
      .@{checkboxInnerPrefixCls}{ //ym-tree-checkbox-inner
        background-color: @primary-color;
        border-color: @primary-color;
        &::after{
          position: absolute;
          display: table;
          border: 2px solid #fff;
          border-top: 0;
          border-left: 0;
          transform: rotate(45deg) scale(1) translate(-50%, -50%);
          opacity: 1;
          transition: all .2s cubic-bezier(.12,.4,.29,1.46) .1s;
          content: " ";
        }
      }
    }
    //3.半选状态
    &-indeterminate{
      .@{checkboxInnerPrefixCls}{ //ym-tree-checkbox-inner
        background-color: #fff;
        border-color: #d9d9d9;
        &::after{
          top: 50%;
          left: 50%;
          width: 8px;
          height: 8px;
          background-color: @primary-color;
          border: 0;
          transform: translate(-50%, -50%) scale(1);
          opacity: 1;
          content: " ";
        }
      }
    }

    // 4.禁止状态
    &-disabled {
      cursor: not-allowed;
      .@{checkboxInnerPrefixCls}{
        background-color: #f5f5f5 !important;
        border-color: #d9d9d9 !important;
        &::after {
          border-color: #00000040 !important;
        }
      }
    }

    //注： 1、2、3影响  ym-tree-checkbox-inner 的background、border-color 和after的形状。
    //4影响ym-tree-checkbox-inner 的background、border-color和after的border, 4会和1/2/3/共存
  }


  // Ttitle
  &-node-content-wrapper {
    flex: auto;
    display: flex;
    flex-flow: row nowrap;
    align-items: center;
    font-size: 14px;
    min-height: 32px;
    overflow-x: hidden;
    // padding: 0 4px;
    background: transparent;
    transition: all .3s, border 0s, line-height 0s, box-shadow 0s;
    cursor: default;
    &-icon {
      flex: 0 0 24px;
      // height: 24px;
      min-height: inherit;
      display: flex;
      flex-flow: row nowrap;
      align-items: center;
      justify-content: center;
      border-top-left-radius:4px;
      border-bottom-left-radius:4px;
    }
    &-title{
      flex: auto;
      min-height: inherit;
      overflow: hidden;
      white-space: nowrap;
      text-overflow: ellipsis;
      padding-right: 4px;
      line-height: 32px;
      border-top-right-radius:4px;
      border-bottom-right-radius:4px;
    }
    &-noicon {
      .@{treePrefixCls}-node-content-wrapper-title{
        padding-left: 4px;
        border-top-left-radius:4px;
        border-bottom-left-radius:4px;
      }
    }
    &-selectable{
      cursor: pointer;
    }
    &-selected{
      .@{treePrefixCls}-node-content-wrapper-icon {
        background-color: rgba(0, 0, 0, 4%);
      }
      .@{treePrefixCls}-node-content-wrapper-title{
        background-color: rgba(0, 0, 0, 4%);
      }
    }
    &-disabled{
      color: #00000040;
      cursor: not-allowed;
    }
    &:hover{
      .@{treePrefixCls}-node-content-wrapper-icon {
        background: #f1f1f1;
      }
      .@{treePrefixCls}-node-content-wrapper-title{
        background: #f1f1f1;
      }
    }
  }

}

